//
//	ZcoModelPeerStatusData.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelPeerStatusData.h"

NSString *const kZcoModelPeerStatusDataAt = @"at";
NSString *const kZcoModelPeerStatusDataIdField = @"id";
NSString *const kZcoModelPeerStatusDataRole = @"role";
NSString *const kZcoModelPeerStatusDataStatus = @"status";
NSString *const kZcoModelPeerStatusDataUser = @"user";

@interface ZcoModelPeerStatusData ()
@end
@implementation ZcoModelPeerStatusData




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelPeerStatusDataAt] isKindOfClass:[NSNull class]]){
		self.at = dictionary[kZcoModelPeerStatusDataAt];
	}	
	if(![dictionary[kZcoModelPeerStatusDataIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kZcoModelPeerStatusDataIdField];
	}	
	if(![dictionary[kZcoModelPeerStatusDataRole] isKindOfClass:[NSNull class]]){
		self.role = dictionary[kZcoModelPeerStatusDataRole];
	}	
	if(![dictionary[kZcoModelPeerStatusDataStatus] isKindOfClass:[NSNull class]]){
		self.status = dictionary[kZcoModelPeerStatusDataStatus];
	}	
	if(![dictionary[kZcoModelPeerStatusDataUser] isKindOfClass:[NSNull class]]){
		self.user = [[ZcoModelUser alloc] initWithDictionary:dictionary[kZcoModelPeerStatusDataUser]];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.at != nil){
		dictionary[kZcoModelPeerStatusDataAt] = self.at;
	}
	if(self.idField != nil){
		dictionary[kZcoModelPeerStatusDataIdField] = self.idField;
	}
	if(self.role != nil){
		dictionary[kZcoModelPeerStatusDataRole] = self.role;
	}
	if(self.status != nil){
		dictionary[kZcoModelPeerStatusDataStatus] = self.status;
	}
	if(self.user != nil){
		dictionary[kZcoModelPeerStatusDataUser] = [self.user toDictionary];
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.at != nil){
		[aCoder encodeObject:self.at forKey:kZcoModelPeerStatusDataAt];
	}
	if(self.idField != nil){
		[aCoder encodeObject:self.idField forKey:kZcoModelPeerStatusDataIdField];
	}
	if(self.role != nil){
		[aCoder encodeObject:self.role forKey:kZcoModelPeerStatusDataRole];
	}
	if(self.status != nil){
		[aCoder encodeObject:self.status forKey:kZcoModelPeerStatusDataStatus];
	}
	if(self.user != nil){
		[aCoder encodeObject:self.user forKey:kZcoModelPeerStatusDataUser];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.at = [aDecoder decodeObjectForKey:kZcoModelPeerStatusDataAt];
	self.idField = [aDecoder decodeObjectForKey:kZcoModelPeerStatusDataIdField];
	self.role = [aDecoder decodeObjectForKey:kZcoModelPeerStatusDataRole];
	self.status = [aDecoder decodeObjectForKey:kZcoModelPeerStatusDataStatus];
	self.user = [aDecoder decodeObjectForKey:kZcoModelPeerStatusDataUser];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelPeerStatusData *copy = [ZcoModelPeerStatusData new];

	copy.at = [self.at copy];
	copy.idField = [self.idField copy];
	copy.role = [self.role copy];
	copy.status = [self.status copy];
	copy.user = [self.user copy];

	return copy;
}
@end